package yjhsgl.action;

import java.util.HashMap;
import java.util.Map;

import yjhsgl.agent.HsclglAgent;
import yjhsgl.agent.HsglAgent;
import common.Const;
import common.MyUtils;
import common.BaseClasses.CommonAction;
import common.BaseClasses.util.IocUtil;

public class HsclglAction extends CommonAction{

	private HsglAgent hsglAgent;
	private HsclglAgent hsclglAgent;
	private  Map<Object, Object> resultMap;
	private  Map<Object, Object> hsclresultMap;
	public HsclglAction(){
		try {
			this.hsglAgent=(HsglAgent) IocUtil.getIocImpl("yjhsgl/ioc/ioc-hsgl.xml","hsglAgent");
			this.hsclglAgent=(HsclglAgent) IocUtil.getIocImpl("yjhsgl/ioc/ioc-hsgl.xml","hsclglAgent");
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	//跳转到会商材料管理页
	public String toHsclglPage(){
		Map map=new HashMap();
		resultMap=hsglAgent.selectHsByPage(1, getIntParameter("pageSize"),map);
		setPageParam(resultMap);
		return "toHsclglPage";
	}
	//材料列表分页
	public String hsclglPage(){
		paramMap.put("met_id", getParameter("met_id",""));
		Map map=new HashMap();
		map.put("met_id", getParameter("met_id"));
		hsclresultMap=hsclglAgent.selectHsclByPage(1, Const.pageSize,map);
		setPageParam(hsclresultMap);
		return "toClListFenYePage";
	}
	//分页查询材料
	public String findClByPage(){
		paramMap.put("met_id", getParameter("met_id",""));
		Map map=new HashMap();
		map.put("met_id", getParameter("met_id"));
		hsclresultMap=hsclglAgent.selectHsclByPage(pageBean.getCurrentPage(), pageBean.getPageSize(), map);
        setPageParam(hsclresultMap);
    	return "toClListFenYePage";
	}
	/**
	 * 保存材料
	 * @return
	 */
	public String saveCl(){
		Map map=new HashMap();
		map.put("id", MyUtils.getUUID());
		map.put("doc_nm", getParameter("faname"));
		map.put("doc_time", getParameter("zdsj"));
		map.put("doc_url", getParameter("pl_filepath"));
		map.put("met_id", getParameter("select_Metid_mark"));
		hsclglAgent.insert(map);
		return "success";
	}
	//分页查询会商
		public String findHsByPageAtClgl(){
	    	paramMap.put("mt_nm", getParameter("mt_nm",""));
	    	paramMap.put("startTime", getParameter("startTime"));
	    	paramMap.put("endTime",getParameter("endTime"));
	    	Map map=new HashMap();
	    	map.put("mt_nm", getParameter("mt_nm",""));
	    	map.put("startTime", getParameter("startTime"));
	    	map.put("endTime",getParameter("endTime"));
	    	resultMap=hsglAgent.selectHsByPage(pageBean.getCurrentPage(), pageBean.getPageSize(), map);
	        setPageParam(resultMap);
	    	return "toHsListFenYePage";
		}

		public String searchHsAtCl(){
			Map map=new HashMap();
	    	map.put("startTime", getParameter("startTime"));
	    	map.put("endTime",getParameter("endTime"));
	    	map.put("met_nm", getParameter("met_nm"));
	    	//将查询条件存入到分页标签里面
	    	paramMap.put("startTime", getParameter("startTime"));
	    	paramMap.put("endTime", getParameter("endTime"));
	    	paramMap.put("eventName", getParameter("eventName"));
	    	resultMap=hsglAgent.selectHsByPage(1, getIntParameter("pageSize"), map);
	    	System.out.println("-------------"+resultMap);
	        setPageParam(resultMap);
	    	return "toHsListFenYePage";
		}
		//删除会商
		 public void deleteHsAtCl(){
		    	String hsIDdArr=getParameter("hsIDdArr");
		    	String result=hsglAgent.deleteHs(hsIDdArr);
		    	writeStringToResponse(result);
		    }
		 //删除材料
		 public void deleteDoc(){
			 String docIdArr=getParameter("clIDdArr");
			 String result=hsclglAgent.deleteDoc(docIdArr);
			 writeStringToResponse(result);
		 }
		
		
		public HsglAgent getHsglAgent() {
			return hsglAgent;
		}

		public void setHsglAgent(HsglAgent hsglAgent) {
			this.hsglAgent = hsglAgent;
		}

		public Map<Object, Object> getResultMap() {
			return resultMap;
		}

		public void setResultMap(Map<Object, Object> resultMap) {
			this.resultMap = resultMap;
		}
		public HsclglAgent getHsclglAgent() {
			return hsclglAgent;
		}
		public void setHsclglAgent(HsclglAgent hsclglAgent) {
			this.hsclglAgent = hsclglAgent;
		}
		public Map<Object, Object> getHsclresultMap() {
			return hsclresultMap;
		}
		public void setHsclresultMap(Map<Object, Object> hsclresultMap) {
			this.hsclresultMap = hsclresultMap;
		}
		
}
